<?php

/**
 * Description of ListaEstudiante
 *
 *
 * @export Modules
 * @export-metadata default-module
 *
 * @export-metadata RequiredRoles:ROLE_PROFESSOR
 */
class ListaEstudiante_Docente extends Module {

    public function index() {

        $NIT = $this->currentUser->getName();

        $Cursos = $this->model->courses->GetByDocente($NIT);

        $this->assign("Cursos", $Cursos);
        $this->assign("action", $this->route->action("loadStudents"));

        $this->display("index");
    }

    public function loadStudents() {
        Loader::using("models::entities::CursoPk");
        Loader::using("models::entities::PeriodoAcademico");

        $periodo = new PeriodoAcademico();
        $periodo->setAno($this->request->get("Ano"));
        $periodo->setPeriodo($this->request->get("Periodo"));

        $CursoPk = new CursoPk();

        $CursoPk->setCodigoMateria($this->request->get("CodigoMateria"));
        $CursoPk->setCodigoPlan($this->request->get("CodigoPlan"));
        $CursoPk->setGrupo($this->request->get("Grupo"));
        $CursoPk->setSemestre($this->request->get("Semestre"));
        $CursoPk->setPerdiodoAcademico($periodo);

        $Estudiantes = $this->model->students->GetListaEstudianteByCurso($CursoPk);

        $this->assign("Estudiantes", $Estudiantes);
        $this->assign("link", $this->route->moduleAction("Perfiles", "index"));

        $this->display();
    }

}

?>